<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Match extends Model
{
    //
    public function level()
    {
        return $this->belongsTo(Level::class, 'level_id', 'id');
    }

    public function group()
    {
        return $this->belongsTo(Group::class, 'group_id', 'id');
    }

    public function sport()
    {
        return $this->belongsTo(SportType::class, 'sport_id', 'id');
    }

    public function venue()
    {
        return $this->belongsTo(Venue::class, 'venue_id', 'id');
    }


    public function reportPeople()
    {
        return $this->hasMany(MatchReport::class, 'match_id', 'id');
    }

    public function scopeSelectNormal($q)
    {
        $q->select('id', 'name');
    }
}
